package com.cavas.domain.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cavas.domain.bean.Pret;
import com.cavas.domain.bean.Remboursement;
import com.cavas.domain.dao.DaoRemboursement;

@Service
@Transactional
public class ServiceRemboursementImpl implements ServiceRemboursement{

	@Autowired
	DaoRemboursement daoRemboursement;
	
	public void setDaoRemboursement(DaoRemboursement dao){
		this.daoRemboursement = dao;
	}
	
	@Override
	public void addRemboursement(Remboursement rbm, Pret pret) {
		 daoRemboursement.addRemboursement(rbm, pret);
		
	}

	@Override
	public List<Remboursement> allRemboursement() {
		// TODO Auto-generated method stub
		return  daoRemboursement.allRemboursement();
	}

	@Override
	public List<Remboursement> allRemboursement(String mail) {
		// TODO Auto-generated method stub
		return  daoRemboursement.allRemboursement(mail);
	}


	@Override
	public Pret getPret(int pret_id) {
		// TODO Auto-generated method stub
		return  daoRemboursement.getPret(pret_id);
	}

	@Override
	public void deleteRemboursement(int id) {
		// TODO Auto-generated method stub
		 daoRemboursement.deleteRemboursement(id);
	}

	@Override
	public int getTotalRemboursement() {
		// TODO Auto-generated method stub
		return  daoRemboursement.getTotalRemboursement();
	}

	@Override
	public int getTotalInteret() {
		// TODO Auto-generated method stub
		return  daoRemboursement.getTotalInteret();
	}

	@Override
	public List<Remboursement> getRemboursement(Pret pret) {
		// TODO Auto-generated method stub
		return daoRemboursement.getRemboursement(pret);
	}

	public void calcolateInteretAndReste(Remboursement rbm){
		 daoRemboursement.calcolateInteretAndReste(rbm);
	}


}
